package com.crawler.gmail.enums;

/**
 * <描述>
 * <详细介绍>
 *
 * @author 王明明
 * @since wiki
 */
public enum MailProtocolEnum {
    POP(0, "pop3"),
    IMAP(1, "imap"),
    EXCHANGE(2, "exchange");

    MailProtocolEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static MailProtocolEnum findByValue(Integer value) {
        switch (value) {
            case 0:
                return POP;
            case 1:
                return IMAP;
            case 2:
                return EXCHANGE;
            default:
                return null;
        }
    }

    private Integer value;
    private String desc;

    public static MailProtocolEnum findByDesc(String protocol) {
        switch (protocol){
            case "imap":
                return IMAP;
            case "pop3":
                return POP;
            case "exchange":
                return EXCHANGE;
        }
        return null;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
